
<h2 align="center">销售订单<%= @order.order_num if @order.id %>信息</h2>

<% form_for @order do |f| %>
    <%= f.error_messages %>
<table width="700" align="center">
  <tr>
    <td width="15%">应到金额(USD)</td>
        <td width="15%">$<%= f.text_field :sumusd_sh, :size => 10 %></td>
    <td width="15%">到款方式</td><td width="20%"><%= select_payment %></td>
        <td width="10%">订单号</td><td width="25%"><%= @order.id ? @order.order_num : f.text_field(:order_num, :size =>15)  %></td>
  </tr>
  <tr>
    <td width="15%">实到金额(USD)</td>
        <td>$<%= f.text_field :sumusd_re, :size => 10 %></td>
        <td width="15%">折合人民币</td><td>￥<%= f.text_field :sum_rmb, :size =>15  %></td>
        <td width="10%">日期</td><td><%= f.date_select :created_at, :use_month_numbers => true %></td></tr>
</table>
<table width="700" align="center">
  <td rowspan="6" width="10%">客户信息</td>
  <tr><td width="10%">客户名称</td><td><%= select_customer %></td><td width="15%">国家</td><td><%= @customer.country if @customer %></td></tr>
  <tr><td width="10%">联系人</td><td><%= @customer.contact if @customer %></td><td width="15%">市场区域</td><td><%= f.text_field :aim_area %></td></tr>
  <tr><td width="10%">E-mail</td><td><%= @customer.email if @customer %></td><td width="15%">电话</td><td><%= @customer.tel if @customer %></td></tr>
  <tr><td width="10%">语言要求</td><td><%= f.text_field :req_lang %></td><td width="15%">使用手册要求</td><td><%= f.text_field :req_manual %></td></tr>
  <tr><td width="10%">频段要求</td><td><%= f.text_field :req_band %></td><td width="15%">充电器要求</td><td><%= select_req_charge %></td></tr>
</table>
<table width="700" align="center">
  <tr>
    <th></th>
    <th>编号</th>
    <th>产品</th>
    <th>数量</th>
    <th>价格</th>
    <th>单位成本</th>
    <th>金额</th>
    <th>备货成本</th>
    <th>相关要求(如CE认证)</th>
  </tr>
<% @lines = [] if @lines.nil?  %>
<td rowspan="<%= (@lines.size + 3)%>" width="10%">备货清单</td>
<% for i in 1..@lines.size 
      line = @lines[i-1] %>
  <tr>    
    <td align="right"><%= i %></td>
    <td><%=h line.product %></td>
    <td><%=h line.qty %></td>
    <td><%=number_to_usd line.price %></td>
    <td><%=number_to_rmb line.unitcost %></td>
    <td><%=number_to_usd line.sum_sales %></td>
    <td><%=number_to_rmb line.sum_cost %></td>
    <td><%=h line.req %></td>
  </tr>  
<% end %>
<tr><td>运费</td><td colspan="3"></td><td></td><td>$<%= f.text_field :delv_price , :size => 10 %></td><td>￥<%= f.text_field :delv_cost , :size => 10 %></td><td></td></tr>
<tr><td>总计</td><td colspan="3"></td><td></td><td><%=number_to_usd @order.total_amount %></td><td><%= number_to_rmb @order.total_cost %></td><td></td></tr>
</table>
<table width="700" align="center">   
   <tr><td rowspan="4" width="10%">发运信息</td><td width="15%">计划发运方式</td><td><%= f.text_field :delv_plan %></td></tr>
   <tr><td>实际发运方式</td><td><%= f.text_field :delv_real %></td></tr>
   <tr><td>跟踪号</td><td><%= f.text_field :track_num %></td></tr>
   <tr><td>收件人信息（地址、电话等）</td><td><%= f.text_area :delv_addr, :cols => 50, :rows => 3 %></td></tr>
</table>
<table width="700" align="center">   
  <tr><td width="15%">订单状态</td><td width="35%"><%= select_order_status %></td><td width="15%">毛利润(RMB)</td><td width="35%"><span><%= number_to_rmb(@order.profit) %></span></td></tr>
</table>
<br>
<div align="center">
  <%= f.submit "保存" %> | 
  <%= @order.id ? 
    link_to("返回", :controller=>'store', :action => 'order_lines', :id => @order.order_num) : link_to("返回列表", :controller=>'orders', :action => 'index')  %>
</div>
<% end %>
<br />


